#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "LED.h"
#include "Switch.h"
#include "Buzzer.h"
#include "Light.h"
#include "OLED.h"
// #include "Light_Interrput.h"
#include "NOLED.h"
#include "string.h"
#include "Timer.h"
#include "Pwm.h"
#include "Car.h"
#include "Usart.h"
#include "stdio.h"
#include "IWDG.h"
#include "WWDG.h"



int main(void)
{
	NOLED_Init();
	NOLED_ShowLineString(0,0,"hello");
	// IWDG_Init(1000);
	WWDG_Init(30, 50);
	
	// enable iwdg 
	// reload iwdg

    if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) == SET) 
	{
        NOLED_ShowLineString(1, 0, "iwdg reset");

    } else if (RCC_GetFlagStatus(RCC_FLAG_WWDGRST) == SET) 
	{
        NOLED_ShowLineString(2, 0, "wwdg reset");
    } else {
        NOLED_ShowLineString(2, 0, "PWR reset");

	}
    RCC_ClearFlag();
    while(1)
	{
		// IWDG_ReloadCounter();
		// Delay_ms(1000);
		Delay_ms(42);
		WWDG_Reload(50);

	}

}
